<template>
  <div>
    <h1>滨海校区学生查询</h1>
    <div>
      <input v-model="studentId" placeholder="请输入学号">
      <button @click="searchStudent">查询</button>
    </div>
    <div v-if="studentInfo">
      <h3>学生信息</h3>
      <p>学号: {{ studentInfo.id }}</p>
      <p>姓名: {{ studentInfo.name }}</p>
      <p>专业: {{ studentInfo.major }}</p>
    </div>
    
    <div class="nav-links">
      <router-link to="/chashan">茶山校区</router-link> |
      <router-link to="/yueqing">乐清校区</router-link> |
      <router-link to="/student">学生管理系统</router-link>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      studentId: '',
      studentInfo: null,
      students: [
        { id: '2023001', name: '张三', major: '计算机科学与技术' },
        { id: '2023002', name: '李四', major: '软件工程' },
        { id: '2023003', name: '王五', major: '数据科学' }
      ]
    }
  },
  methods: {
    searchStudent() {
      this.studentInfo = this.students.find(s => s.id === this.studentId)
      if (!this.studentInfo) {
        alert('未找到该学号的学生信息')
      }
    }
  }
}
</script>

<style scoped>
.nav-links {
  margin-top: 20px;
}
input {
  padding: 8px;
  margin-right: 10px;
}
button {
  padding: 8px 16px;
}
</style>